from django.db import models

# Create your models here.
class User(models.Model):
    USER_TYPE= (
        (0,'学生'),
        (1, '老师'),
    )
    username = models.CharField(max_length=30,verbose_name='用户名')
    password = models.CharField(max_length=100,verbose_name='密码')
    type = models.IntegerField(default=0,verbose_name='类型',choices=USER_TYPE)
    class Meta:
        db_table = 'user'
        verbose_name = '老师表'
        verbose_name_plural = verbose_name



class Classes(models.Model):
    name = models.CharField(max_length=20,verbose_name='班级名称')

    class Meta:
        db_table = 'classes'
        verbose_name = '班级表'
        verbose_name_plural = verbose_name
class Student(models.Model):
    SEX_TYPE = (
        (0,'男'),
        (1, '女'),
    )
    username = models.CharField(max_length=30,verbose_name='用户名')
    sex = models.IntegerField(default=0,verbose_name='用户名',choices=SEX_TYPE)
    age = models.IntegerField(default=0,verbose_name='年龄')
    phone = models.CharField(max_length=11,verbose_name='联系方式')
    address = models.CharField(max_length=100,verbose_name='联系地址')
    classes = models.ForeignKey('Classes',on_delete=models.CASCADE)

    class Meta:
        db_table = 'student'
        verbose_name = '学生表'
        verbose_name_plural = verbose_name